The Show pop-up menu displayed in Open dialog boxes and the Format pop-up menu displayed in Save dialog boxed are known collectively as type pop-up menus. If your application needs to add its own menu items to one of the type pop-up menus, use a structure of type to describe each menu item to add. This allows you to add specific document types to be opened or saved, or different ways of saving a file (with or without line breaks, as HTML, and so forth). To set your menu items, add a handle to one or more structures to the
popupExtension
field in the structure of type that you pass in the
dialogOptions
parameter of the appropriate function. If you provide a structure, you must also provide an event-handling function and an object filtering function. Navigation Services will not handle your custom menu items, so if you do not provide these application-defined functions and attempt to use a structure, Navigation Services functions return a result of
paramErr
(-50). For more information, see Creating Application-Defined Functions.
You are not required to provide a value in the
menuItemName
field of the
NavMenuItemSpec
structure, but Navigation Services uses this value, if it is available, as a search key. If you choose not to provide a value for this field, make sure to set it to an empty string.
To handle and examine a selected pop-up menu item, respond to the
kNavCBPopupMenuSelect
constant, described in , when Navigation Services calls your application's event-handling function. Navigation Services provides information about the selected menu item in a structure of type passed in the
callBackParms
parameter of your event-handling function. The
param
field of the
NavCBRec
structure points to a structure of type describing the menu item. Your application can respond to a particular menu item by comparing the
type
and
creator
fields, for example.
You can set the Show pop-up menu so that it displays only custom items during a call to a file-opening function such as , for instance. The procedure is as follows:
popupExtension
field of the structure of type that you pass in the
dialogOptions
parameter.
NULL
in the
typeList
parameter. If you pass any file types in the
typeList
parameter, Navigation Services will place its own items in the pop-up menu.
If your application tries to extend the Show pop-up menu and does not provide an event-handling function, Navigation Services functions return a result of
paramErr
(-50). If you add menu items that require filtering, you must implement a filter function. For more information, see Filtering File Objects.
You can set the Format pop-up menu so that it displays only custom items during a call to the function. The procedure is as follows:
popupExtension
field of the structure of type that you pass in the
dialogOptions
parameter.
kNavGenericSignature
constant in the
fileCreator
parameter of the
NavPutFile
function.
kNavAllowStationery
constant in the
dialogOptions
field of the
NavDialogOptions
structure you pass to the
NavPutFile
function.